<?php

namespace App\Http\Requests;

use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;

class Base extends FormRequest
{

    protected function failedValidation(Validator $validator)
    {

        $allErrors  = json_decode(json_encode($validator->errors()), true);
        $firstError = array_shift($allErrors)[0];
        return showError($firstError);
        exit;
    }
}
